package com.starwish.starwishblog.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.starwish.starwishblog.entity.OperationLog;
import com.starwish.starwishblog.mapper.OperationLogMapper;
import com.starwish.starwishblog.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogService {

    @Autowired
    OperationLogMapper operationLogMapper;

    public PageInfo<ManagerOperationVo> queryManagerOperationByPages(Integer now, Integer size, String name) {
        PageHelper.startPage(now, size);
        List<ManagerOperationVo> list = operationLogMapper.selectManagerOperationLog(name);

        return new PageInfo<>(list);
    }

    public PageInfo<ManagerLoginVo> queryManagerLoginByPages(Integer now, Integer size, String name) {
        PageHelper.startPage(now, size);
        List<ManagerLoginVo> list = operationLogMapper.selectManagerLoginLog(name);
        return new PageInfo<>(list);
    }

    public PageInfo<UserOperationVo> queryUserOperationByPages(Integer now, Integer size, String name) {
        PageHelper.startPage(now, size);
        List<UserOperationVo> list = operationLogMapper.selectUserOperationLog(name);
        return new PageInfo<>(list);
    }

    public PageInfo<UserLoginVo> queryUserLoginByPages(Integer now, Integer size, String name) {
        PageHelper.startPage(now, size);
        List<UserLoginVo> list = operationLogMapper.selectUserLoginLog(name);
        return new PageInfo<>(list);
    }
}
